﻿<phone:PhoneApplicationPage x:Class="WP7UIKit.Views.WaterFallDemoPage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
                            xmlns:Converter="clr-namespace:WP7UIKit.Converter"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:Toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                            xmlns:UIKit="clr-namespace:UIKit.Controls;assembly=UIKit"
                            d:DesignHeight="768"
                            d:DesignWidth="480"
                            Orientation="Portrait"
                            shell:SystemTray.IsVisible="True"
                            SupportedOrientations="Portrait"
                            mc:Ignorable="d">
    <phone:PhoneApplicationPage.Resources>
        <Converter:BoolToVisibleConverter x:Key="VisibleConverter" />
        <DataTemplate x:Key="DataTemplate1">
            <Grid Width="{Binding Width}"
                  Height="{Binding Height}"
                  Background="DarkGray">
                <Image Source="{Binding Url, Mode=OneWay}" Stretch="UniformToFill" />
                <Image Source="/Images/favorites.checked.png"
                       Stretch="Fill"
                       Visibility="{Binding IsChecked,
                                            Converter={StaticResource VisibleConverter}}" />
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="DataTemplate2">
            <Grid>
                <Rectangle Height="100"
                           Fill="#FFB5F70C"
                           Stroke="Black" />
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

    <!--  Sample code showing usage of ApplicationBar  -->
    <!--
        <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
        <shell:ApplicationBar.MenuItems>
        <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
        <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
        </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
        </phone:PhoneApplicationPage.ApplicationBar>
    -->

    <phone:PhoneApplicationPage.DataContext>
        <Binding Mode="OneWay"
                 Path="WaterViewModel"
                 Source="{StaticResource Locator}" />
    </phone:PhoneApplicationPage.DataContext>
    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal" />
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal" />
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush" />
    </phone:PhoneApplicationPage.Foreground>

    <!--  LayoutRoot is the root grid where all page content is placed  -->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="0.9*" />
            <RowDefinition Height="0.1*" />
        </Grid.RowDefinitions>
        <UIKit:WaterFallList x:Name="MyImageWall"
                             ColumnCount="{Binding ColumnCount}"
                             ColumnMargin="{Binding ColumnMargin}"
                             IsFlat="False"
                             IsInDelMode="{Binding IsInDelMode}"
                             ItemsSource="{Binding Items}"
                             ItemTemplate="{StaticResource DataTemplate1}"
                             SelectedItem="{Binding SelectedItem,
                                                    Mode=TwoWay}" Background="White">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                    <Command:EventToCommand Command="{Binding OnItemSelectCommand}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </UIKit:WaterFallList>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*" />
                <ColumnDefinition Width="0.5*" />
            </Grid.ColumnDefinitions>
            <Button x:Name="DeleteBtn"
                    Grid.Column="0"
                    Command="{Binding DeleteItemCommand,
                                      Mode=OneWay}"
                    Content="Delete" />
            <Button x:Name="LoadingBtn"
                    Grid.Column="1"
                    Command="{Binding LoadDataCommand,
                                      Mode=OneWay}"
                    Content="Loading" />
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>
